﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data; 
using System.Data.Common; 
using WMSADBUtility;
using WMSAML.SY;

namespace WMSADL.SY
{
    public class TAutoFiles_DAL
    {
        #region  Method
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TAutoFiles_Entity GetEntity(int NID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT TOP 1 Vison FROM TAutoFiles ORDER BY NID DESC ");
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            TAutoFiles_Entity entity = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    entity = ReaderBind(dataReader);
                }
            }
            return entity;
        }
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public TAutoFiles_Entity ReaderBind(IDataReader dataReader)
        {
            TAutoFiles_Entity entity = new TAutoFiles_Entity();
            entity.Vison = dataReader["Vison"].ToString();
            return entity;
        }

        #endregion  Method
    }
}
